package androidx.appcompat.graphics.drawable;

import android.graphics.Canvas;
import android.graphics.ColorFilter;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import androidx.annotation.RestrictTo;
import androidx.annotation.RestrictTo.d;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import o.gg;

public class DrawerArrowDrawable extends Drawable {
    private static final float ˋ = ((float) Math.toRadians(45.0d));
    private float ʻ;
    private boolean ʼ;
    private final int ʽ;
    private float ˊ;
    private float ˊॱ;
    private int ˋॱ;
    private float ˎ;
    private float ˏ;
    private float ͺ;
    private final Paint ॱ;
    private boolean ॱॱ;
    private final Path ᐝ;

    @RestrictTo({d.LIBRARY_GROUP})
    @Retention(RetentionPolicy.SOURCE)
    public @interface ArrowDirection {
    }

    public void draw(Canvas canvas) {
        int i;
        float f;
        float f2;
        Rect bounds = getBounds();
        switch (this.ˋॱ) {
            case 0:
                i = 0;
                break;
            case 1:
                i = 1;
                break;
            case 3:
                if (gg.ᐝ(this) != 0) {
                    i = 0;
                    break;
                } else {
                    i = 1;
                    break;
                }
            default:
                if (gg.ᐝ(this) != 1) {
                    i = 0;
                    break;
                } else {
                    i = 1;
                    break;
                }
        }
        float ˎ = ˎ(this.ˊ, (float) Math.sqrt((double) ((this.ˏ * this.ˏ) * 2.0f)), this.ͺ);
        float ˎ2 = ˎ(this.ˊ, this.ˎ, this.ͺ);
        float round = (float) Math.round(ˎ(0.0f, this.ˊॱ, this.ͺ));
        float ˎ3 = ˎ(0.0f, ˋ, this.ͺ);
        if (i != 0) {
            f = 0.0f;
        } else {
            f = -180.0f;
        }
        if (i != 0) {
            f2 = 180.0f;
        } else {
            f2 = 0.0f;
        }
        f2 = ˎ(f, f2, this.ͺ);
        f = (float) Math.round(((double) ˎ) * Math.cos((double) ˎ3));
        ˎ = (float) Math.round(((double) ˎ) * Math.sin((double) ˎ3));
        this.ᐝ.rewind();
        ˎ3 = ˎ(this.ʻ + this.ॱ.getStrokeWidth(), -this.ˊॱ, this.ͺ);
        float f3 = (-ˎ2) / 2.0f;
        this.ᐝ.moveTo(f3 + round, 0.0f);
        this.ᐝ.rLineTo(ˎ2 - (round * 2.0f), 0.0f);
        this.ᐝ.moveTo(f3, ˎ3);
        this.ᐝ.rLineTo(f, ˎ);
        this.ᐝ.moveTo(f3, -ˎ3);
        this.ᐝ.rLineTo(f, -ˎ);
        this.ᐝ.close();
        canvas.save();
        f = this.ॱ.getStrokeWidth();
        canvas.translate((float) bounds.centerX(), ((f * 1.5f) + this.ʻ) + ((float) ((((int) ((((float) bounds.height()) - (3.0f * f)) - (this.ʻ * 2.0f))) / 4) * 2)));
        if (this.ʼ) {
            canvas.rotate(((float) ((i ^ this.ॱॱ) != 0 ? -1 : 1)) * f2);
        } else if (i != 0) {
            canvas.rotate(180.0f);
        }
        canvas.drawPath(this.ᐝ, this.ॱ);
        canvas.restore();
    }

    public void setAlpha(int i) {
        if (i != this.ॱ.getAlpha()) {
            this.ॱ.setAlpha(i);
            invalidateSelf();
        }
    }

    public void setColorFilter(ColorFilter colorFilter) {
        this.ॱ.setColorFilter(colorFilter);
        invalidateSelf();
    }

    public int getIntrinsicHeight() {
        return this.ʽ;
    }

    public int getIntrinsicWidth() {
        return this.ʽ;
    }

    public int getOpacity() {
        return -3;
    }

    private static float ˎ(float f, float f2, float f3) {
        return ((f2 - f) * f3) + f;
    }
}
